# # 1.打开文件
# f = open('a.tex', mode='w', encoding='utf-8')
# # 2.写文件
# f.write('hello world\n好好学习\n天天向上')
# f.close()
# # 3.读文件
# f = open('a.tex', mode='r', encoding='utf-8')
# data = f.read()
# print(data)
# f.close()

# with open('b.txt', 'w', encoding='utf-8') as file:
#     file.write('hello world\n好好学习\n天天向上')
with open('b.txt', 'r', encoding='utf-8') as file:
        buf = file.readline()
        print(buf)
        # buf1 = file.readline()
        # print(buf1)

